      SUBROUTINE GENABC(T,Y1,Y3,Y4,Y,C,BA,A,B,WRK12,WRK2,M,MT2,MX,MXT2)
C
C     THIS SUBROUTINE GENERATES THE COEFFICEINTS OF THE OUTGOING
C     AND INGOING WAVES USING THE EQUATIONS: COL[B,A]=T*Y*C
C
      IMPLICIT REAL*8 (A-H,O-Z)
      COMPLEX*16 T(MXT2,MXT2),Y(MXT2,MXT2)
      COMPLEX*16 Y1(MX,MX),Y3(MX,MX),Y4(MX,MX)
      COMPLEX*16 WRK2(MXT2,MXT2)
      COMPLEX*16 A(MX),B(MX),C(MXT2),BA(MXT2),WRK12(MXT2)
      COMPLEX*16 ZERO
C
      ZERO=DCMPLX(0.0,0.0)
C
      DO 300 II=1,M
C
      BA(II)  =C(II)
      BA(II+M)=C(II+M)
C
      DO 200 I=1,M
C
      Y(I,II)    = Y4(I,II)
      Y(I,II+M)  = Y3(I,II)
      Y(I+M,II)  = ZERO
      Y(I+M,II+M)= Y1(I,II)
C
  200 CONTINUE
  300 CONTINUE
C
C     BA=T*Y*C
C
      CALL MMULT(T,Y,WRK2,MT2,MXT2)
      CALL CVMULT(MT2,WRK2,BA,MXT2,WRK12)
C
      DO 500 I=1,M
      B(I)=BA(I)
      A(I)=BA(I+M)
  500 CONTINUE
C
      RETURN
      END
